#pragma once

#include <QObject>
#include <QUuid>
#include <QMap>
#include <QXmlStreamReader>
#include <QTextCodec>
#include "response.h"

class Trainer : public QObject
{
	Q_OBJECT

public:
	

	typedef struct  _MEMINFOS_ {
		QString pattern;
		QString content;
	}MEMINFOS;


public:
	Trainer(QObject *parent);
	~Trainer();
	Trainer();

	void parserStarUpXml(QString path);
	QStringList learn(QString path);
	QString parserCategory(QXmlStreamReader &reader);
	static QUuid  getUUid();
	QList<Response::resultStruct> get_response(QString input);
	int calcDistance(const QString source, const QString target);
	Response::resultStruct prehandle(QString text);

	QStringList findPatterns(QString filename);
	QStringList getPatternKeys();
private:

	QMap<QUuid, MEMINFOS> _map;
	QMap<QString ,QStringList> _patternMap;
	QTextCodec *codec;

};
